All Packages Class Hierarchy This Package Previous Next Index
Interface sun.server.util.DiskCache
- public interface DiskCache
This is a disk cache interface that stores and retrieves
URL contents on the disk. It has a pluggable replacement
policy object that decides on replacement policies.
-
dropReadLock(URLContents)
- If a non - NULL URLContents is returned by invoking
getRadLockedContents(), this call is mandatory after the
application has finished reading the contents.
-
entries()
- This returns an enumeration of cache entries in the cache i.e an
enumeration of URLContents objects.
-
getReadLockedContents(URL, FetchContents)
- This reads the cache entry for the URL.
-
remove(URL)
- This method removes the url and its associated contents from the cache.
-
setPath(String)
- Set the path to the disk cache
-
setReplacementPolicy(CacheReplacer)
- When files are to be replaced, the CacheReplacer chooses which enties
must go.
-
setSize(int)
- Set the size of the disk cache.
setPath
public abstract void setPath(String fullPathName)
- Set the path to the disk cache
- Parameters:
- fullPathName - the path to the place where the files are stored
setSize
public abstract void setSize(int sizeInBytes)
- Set the size of the disk cache.
- Parameters:
- sizeInBytes - the total size of the disk cache in bytes.
setReplacementPolicy
public abstract void setReplacementPolicy(CacheReplacer cr)
- When files are to be replaced, the CacheReplacer chooses which enties
must go.
- Parameters:
- cr - the CacheReplacer object that dictates replacement policy.
getReadLockedContents
public abstract URLContents getReadLockedContents(URL url,
FetchContents fc) throws IOException
- This reads the cache entry for the URL. If the URL is cached, the
contents of the cache is returned. Otherwise, the get method of the
FetchContents interface is called to retrieve the contents in an
application specific way. The contents returned by FetchContents are
cached, and a copy is returned to the application.
- Parameters:
- url - - the url that must be read.
- fc - - the FetchContents interface that must be implemented by the
application. The get() method of the FetchContents interface
is called when there is a cache miss.
- Returns:
- URLContents - the contents of the URL, either read from the cache
or by calling FetchContents.
- Throws: IOException
- - an IOException occured while reading the URL
contents.
dropReadLock
public abstract void dropReadLock(URLContents uc)
- If a non - NULL URLContents is returned by invoking
getRadLockedContents(), this call is mandatory after the
application has finished reading the contents.
remove
public abstract void remove(URL url)
- This method removes the url and its associated contents from the cache.
- Parameters:
- url - - this is the URL that has to be flushed from the cache.
entries
public abstract URLContents[] entries()
- This returns an enumeration of cache entries in the cache i.e an
enumeration of URLContents objects.
This is a dirty read and represents a snapshot of the cache as
it was when the call was made. This information can
only used for reading the meta information and deciding which entries
to replace. It is typically used by the CacheReplacer object.
- Returns:
- the list of CacheEntry in this cache.
All Packages Class Hierarchy This Package Previous Next Index